from django.conf.urls.defaults import *
from django_restapi.model_resource import Collection
from django_restapi.receiver import *
from django_restapi.responder import *
from gaevents.models import * 

businesses = Gabusiness.objects.all()

gaevent_xml_resource = Collection(
    queryset = Gaevent.objects.all(),
    permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),
    responder = TemplateResponder(
	template_dir = 'gaevents',
	template_object_name= 'gaevent'
	extra_content = { 'businesses': businesses }
    ),
    receiver = XMLReceiver(),
    )


gaevent_json_resource= Collection(
    queryset = Gaevent.objects.all(),
    permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),
    responder = JSONResponder(),
    receiver = JSONReceiver(),
    )

gaeventlocation_xml_resource = Collection(
    queryset = Gaeventlocation.objects.all(),
    permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),
    responder = XMLResponder(),
    receiver = XMLReceiver(),
    )

gaeventlocation_json_resource= Collection(
    queryset = Gaeventlocation.objects.all(),
    permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),
    responder = JSONResponder(),
    receiver = JSONReceiver(),
    )

gabusiness_xml_resource = Collection(
    queryset = Gabusiness.objects.all(),
    permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),
    responder = XMLResponder(),
    receiver = XMLReceiver(),
    )

gabusiness_json_resource = Collection(
    queryset = Gabusiness.objects.all(),
    permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),
    responder = JSONResponder(),
    receiver = JSONReceiver(),
    )


gabusinesslocation_xml_resource = Collection(
    queryset = Gabizlocation.objects.all(),
    permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),
    responder = XMLResponder(),
    receiver = XMLReceiver(),
    )

gabusinesslocation_json_resource = Collection(
    queryset = Gabizlocation.objects.all(),
    permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),
    responder = JSONResponder(),
    receiver = JSONReceiver(),
    )




urlpatterns = patterns('',
   url(r'^gaevent/xml/(.*?)/?$', gaevent_xml_resource),
   url(r'^gaevent/json/(.*?)/?$', gaevent_json_resource),
   url(r'^gaeventlocation/xml/(.*?)/?$', gaeventlocation_xml_resource),
   url(r'^gaeventlocation/json/(.*?)/?$', gaeventlocation_json_resource),
   url(r'^gabusiness/xml/(.*?)/?$', gabusiness_xml_resource),
   url(r'^gabusiness/json/(.*?)/?$', gabusiness_json_resource),
   url(r'^gabusinesslocation/xml/(.*?)/?$', gabusinesslocation_xml_resource),
   url(r'^gabusinesslocation/json/(.*?)/?$', gabusinesslocation_json_resource),
)

